package com.msh.automatic.android.api.configurer;

import com.msh.automatic.android.api.configurer.interceptor.AdminInterceptor;
import com.msh.automatic.android.api.configurer.interceptor.DeviceActivationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    //注入
    @Autowired
    private AdminInterceptor adminInterceptor;
    //注入
    @Autowired
    private DeviceActivationInterceptor deviceActivationInterceptor;

    //将拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(adminInterceptor)
                .addPathPatterns("/a/**");
        registry.addInterceptor(deviceActivationInterceptor)
                .addPathPatterns("/d/**");
    }
}